from Autotests.Suites.StressTest.Statistics import Statistics
from Reporting.Mailer import Mailer
from time import sleep

class MailerProcess:

    mailSendIntervalInSeconds = 3600

    @staticmethod
    def sendMail(statistics):
        mailer = Mailer("StressTestClient", 'vasili@iaso.com')
        mailer.sendMail(["vasili@iaso.com"], 'StressTest statistics', statistics.getStatistics())
        pass

    @staticmethod
    def runMailer():
        statistics = Statistics()
        while True:
            sleep(MailerProcess.mailSendIntervalInSeconds)
            MailerProcess.sendMail(statistics)

if __name__ == "__main__":
    MailerProcess.runMailer()
